﻿
@using WHLRDF.ORG.Model;
@{

    ViewData["Title"] = "ORG_DeptCheckLog 管理";

}

@section links{
 
    <style type="text/css">
        html, body {
            margin: 0px;
            padding: 0px;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }

        #orgChartContent {
            width: 100%;
            height: 96%;
        }

        .btn path {
            fill: #dbdbdb;
        }

        .btn:hover path {
            fill: #ffffff;
        }

        select, input[type=text], input[type=email] {
            width: 100%;
        }
    </style>
}

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content text-center p-md ibox-content-search">
                    <form class="form-horizontal" datatable="tableGrid">
                        <div class="form-group col-md-4">
                            <label for="keyWord" class="col-md-3 control-label text-right">关键字</label>
                            <div class="col-md-9">
                                <input id="keyWord" name="keyWord" class="form-control" placeholder="关键字" />
                            </div>
                        </div>

                        <div>
                            <a class="btn btn-primary pull-right btn-rounded btn-search"><i class="fa fa-search"></i>搜  索</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content text-center p-md">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover dataTables" id="tableGrid">
                            <thead>
                                <tr>
                                    <td>
                                        <div class="i-checks">
                                            <label> <input type="checkbox" class="thead checkall" title="全选" /></label>
                                        </div>
                                    </td>
                                    <td> 名称</td>
                                    <td> 状态</td>
                                    <td> 操作人</td>
                                    <td> 修改时间</td>
                                    <td> 操作</td>
                                </tr>

                            </thead>

                            <tfoot>

                                <tr>
                                    <td>
                                        <div class="i-checks">
                                            <label> <input type="checkbox" class="tfoot checkall" title="全选" /></label>
                                        </div>
                                    </td>
                                    <td> 名称</td>
                                    <td> 状态</td>
                                    <td> 操作人</td>
                                    <td> 修改时间</td>
                                    <td> 操作</td>
                                </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="orgchart-modal" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">组织机构图</h4>
            </div>
            <div class="modal-body" style="padding:5px;">
                <div class="orgchart" id="orgChartContent" style=""></div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white btn-close" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>>
@section scripts{

    <script type="text/javascript">
    BaseUrl="@Url.Content("~/ORG")";
    $(document).ready(function () {
    var table = $(".dataTables").CustomForm({
    isValidate: false,
    isTable: true,
    "order": [[4, "desc"]], //默认排序
        ajaxUrl: "@Url.Action("ForGrid")",
        actionClick: function (target) {
            Ajax({
                url: "@Url.Action("GetOrgChartByLogId")",
                data: { id: target.attr("id") },
                success: function (result) {
                    if (result && result!=null&& result.JobData && result.JobData.length > 0) {

                        $("#orgChartContent").remove();
                        $("#orgchart-modal").modal("show").on('shown.bs.modal', function (e) {

                            // 关键代码，如没将modal设置为 block，则$modala_dialog.height() 为零
                            $("#orgchart-modal").find(".modal-body").html("<div class='orgchart' id='orgChartContent' ></div>");
                            OChart.InitOrgChart(result, "orgChartContent", true);
                            });



                    }
                    else {
                        Notify.Error("暂无数据");
                    }
                }
            });
        },
    "columns": [
    CONSTANT.DATA_TABLES.COLUMN.CHECKBOX("DeptCheckLogId")


                    ,{

                    "name": "DepartmentName",
                    "data":"DepartmentName",
                    "title": " 名称",
                    "sDefaultContent": "",
                    "type": 'string',
                    "format":'',
                    "bSortable":true

                }

                    ,{

                    "name": "Status",
                    "data":"Status",
                    "title": " 状态",
                    "sDefaultContent": "",
                    "type": 'int',
                    "format":'',
                    "bSortable":true
                        ,render: function (data, type, row)
                        {
                            if (row.Status == 0)
                            {
                                return "迁出";
                            }
                            if (row.Status == 1) {
                                return "迁入";
                            }
                            if (row.Status == 1) {
                                return "撤销迁出";
                            }
                        }


                    }, {

                        "name": "CreateBy",
                        "data": "CreateBy",
                        "title": " 操作人",
                        "sDefaultContent": "",
                        "type": 'string',
                        "format": '',
                        "bSortable": true

                    }, CONSTANT.DATA_TABLES.COLUMN.LASTMODIFYDATE
                   , CONSTANT.DATA_TABLES.COLUMN.ACTIONBTN("DeptCheckLogId",  "", [
                {
                    name: "显示",
                    data: "DeptCheckLogId",
                    icon: "fa-paste",

                }])
    ],
    "fnServerParams": function(data) {
    data.keyWord = $("#keyWord").val();//搜索参数
    }
    });

    });


    </script>
}
